package be.castanea.client.services.util;

import be.castanea.client.model.Mob;
import be.castanea.client.model.World;
import be.castanea.common.util.GenericEvent;

/**
 * SCJDeveloper Assignment
 * September 2008
 * @author Geert van Leemputten (XT-I)
 */
public abstract class GenericCommand {

    protected GenericEvent event;

    public GenericCommand() {
    }

    public void setEvent(GenericEvent event) {
        this.event = event;
    }

    protected final World getWorld() {
        if (event == null) {
            throw new RuntimeException("The command is missing its originating event.");
        }
        return World.getInstance();
    }

    protected final Mob getMob() {
        if (event == null) {
            throw new RuntimeException("The command is missing its originating event.");
        }
        return World.getInstance().getMob(event.getOriginator());
    }

    public abstract void execute(float interpolation);
}
